package com.kamistoat.meimeimall.common.constant;

import java.util.concurrent.TimeUnit;

public class SecKillConstant {
    /**
     * 当前时间正在进行的秒杀商品.
     */
    public static final String CURRENT_SEC_SESSION_PREFIX = "seckill:current:session:";
    /**
     * 每一场秒杀活动的缓存key - seckill:session:id:startTime_endTime
     */
    public static final String SEC_SESSION_PREFIX = "seckill:session:";
    /**
     * 一件商品未来所有的秒杀信息
     */
    public static final String SEC_PRODUCT_MAP_PREFIX = "seckill:product:map:";
    public static final String SEC_PRODUCT_SEMAPHORE = "seckill:product:semaphore:" ;  // 缓存秒杀商品信息的虚拟库存信号量键 前缀
    public static final String SEC_USER_PRODUCT_COUNT = "seckill:user:product:count:";  // 缓存一个用户在本场秒杀活动中累计购买的商品数量 前缀

    public enum SecKillSessionStatus{
        SESSION_VALID(1,"正常"),
        SESSION_TERMINATE(0,"异常终止");

        private Integer code;
        private String message;

        SecKillSessionStatus(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }
    }
}
